package ntu.sce.fyp.easilocation.datastore.model;

import java.util.Date;
import java.util.List;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import com.google.appengine.api.datastore.Key;

@PersistenceCapable
public class User {

	@Persistent(valueStrategy=IdGeneratorStrategy.IDENTITY) @PrimaryKey private Key key; 
	@Persistent private String username;
	@Persistent private String password;
	@Persistent private String email;
	@Persistent private String phone;
	@Persistent private Date joined_date;
	@Persistent(mappedBy="username") private List<Location> locations;
	
	public User(String username, String password, String email, String phone, Date now, List<Location> locations) {
		this.username = username;
		this.password = password;
		this.email = email;
		this.phone = phone;
		this.joined_date = now;
		this.locations =  locations;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public Date getJoined_date() {
		return joined_date;
	}

	public void setJoined_date(Date joinedDate) {
		joined_date = joinedDate;
	}

	public List<Location> getLocations() {
		return locations;
	}

	public void setLocations(List<Location> locations) {
		this.locations = locations;
	}
}
